<template>
  <div>
    <div class="about">
      <div class="logo">
        <img src="../assets/homepage/logo.png" alt="" class="banner" />
      </div>
      <div class="dianhua">
        <img src="../assets/homepage/dianhua.png" alt="" class="pic" />
        <span class="phone">17607111277</span>
      </div>
    </div>

    <div class="Navigation">
      <div
        v-for="(item, index) in navigaList"
        :key="index"
        class="Navigationer"
      >
        <div
          :class="item.index == currentindex ? 'option2' : 'option'"
          @click="navigat(item)"
        >
          {{ item.name }}
        </div>
      </div>
    </div>
   
      <el-carousel height="420px">
        <el-carousel-item v-for="item in bannerList" :key="item.id">
          <div>
            <img :src="imgurl + item.image" alt="" class="bannerlist" />
          </div>
          
        </el-carousel-item>
      </el-carousel>
    
  </div>
</template>

<script>
export default {
  name: "heade",
  data() {
    return {
      navigaList: [
        {
          index: 1,
          path: "/welcome",
          name: "网站首页"
        },
        {
          index: 2,
          path: "/cemetery",
          name: "陵园墓地"
        },
        {
          index: 3,
          path: "/funeralhome",
          name: "殡仪馆"
        },
        {
          index: 8,
          path: "/articles",
          name: "殡葬用品"
        },
        {
          index: 4,
          path: "/info",
          name: "新闻资讯"
        },
        {
          index: 5,
          path: "/service",
          name: "服务流程"
        },
        {
          index: 6,
          path: "/aboutus",
          name: "关于我们"
        },
        {
          index: 7,
          path: "/contactus",
          name: "联系我们"
        }
      ],
      currentindex: "0",
      bannerList: [],
      imgurl: "https://www.gongminlingyuanwang.cn/"
    };
  },
  created() {
    this.navigat(this.navigaList[0]);
  },

  methods: {
    async navigat(item) {
      console.log(item);
      this.currentindex = item.index;
      this.$router.push(item.path);
      const { data: res } = await this.$axios.post("index/getBanner", {
        type: item.index
      });
      this.bannerList = res.data;
      console.log(this.bannerList);
    }
  }
};
</script>

<style lang="scss">

  .about {
    width: 70%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
  }
    
  .logo {
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .dianhua {
    display: flex;
    align-items: center;
  }
  .dianhua .pic {
    width: 30px;
    height: 30px;
  }
  .dianhua .phone {
    font-size: 18px;
    font-family: Microsoft YaHei;
    font-weight: bold;
    color: #333333;
    padding-left: 10px;
  }
  .banner {
    width: 100%;
    /* width: 388px; */
    // height: 48px; 
  }
  .Companyname {
    padding-left: 20px;
  }
  .Navigation {
    width: 100%;
    height: 54px;
    margin-top: 21px;
    background-color: #212121;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .Navigationer {
    padding-right: 4%;
  }
  .option {
    color: #fefbfb;
    font-size: 16px;
    cursor: pointer;
  }
  .option2 {
    color: #ee9f07;
    font-size: 16px;
    cursor: pointer;
  }
  .bannerlist {
    width: 100%;
    height: 420px;
  }



</style>
